package com.henu.rescue.service.impl;

import com.henu.rescue.entity.Complain;
import com.henu.rescue.entity.VO.ComplainVO;
import com.henu.rescue.entity.VO.EvaluateVO;
import com.henu.rescue.entity.VO.StandardNameComplainCount;
import com.henu.rescue.mapper.ComplainMapper;
import com.henu.rescue.service.ComplainService;
import com.henu.rescue.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ComplainServiceImpl implements ComplainService {

    @Autowired
    private ComplainMapper complainMapper;

    @Override
    public Integer addComplain(Complain complain) {
        return complainMapper.addComplain(complain);
    }

    @Override
    public String getStandardName(Integer standardId) {
        return complainMapper.getStandardName(standardId);
    }

    @Override
    public Page<ComplainVO> getAllComplainByPage(Page<ComplainVO> page) {
        List<ComplainVO> complainList = complainMapper.selectComplainInfoByPage(page);
        page.setList(complainList);
        //查询总数
        int totalCount =complainMapper.getCountByPage(page);
        page.setTotalCount(totalCount);
        return page;
    }

    @Override
    public Integer updateStatus(Integer comId) {
        return complainMapper.updateStatus(comId);
    }

    @Override
    public List<StandardNameComplainCount> getComplaintCountByStandard() {
        return  complainMapper.getComplaintCountByStandard();
    }

    @Override
    public Integer getCount(){
        return complainMapper.getCount();
    }

    @Override
    public Integer selectCountByOrderIdAndStandId(Complain complain) {
        return complainMapper.selectCountByOrderIdAndStandId(complain);
    }

    @Override
    public Integer update(ComplainVO complainVO) {
        return complainMapper.update(complainVO);
    }

    @Override
    public Complain getComplainById(Integer id) {
        return complainMapper.getComplainById(id);
    }


}
